<div class="wrapper">
    <div>
        <div class="box box-top">
            <!-- /.box-header -->
            <!-- form start -->
            <form id="depositForm" role="form" action="${base}/admin/deposit/save" method="post">
                <input type="hidden" name="id" value="${(deposit.id)!}">
                <input type="hidden" value="${(deposit.departmentId)!}" class="form-control" name="departmentId" id="departmentId">
                <div class="box-body">
                    <div class="form-group">
                        <label for="departmentId">区域Id</label>
                        <input type="text" disabled value="${(deposit.department.name)!}" class="form-control">
                    </div>
                    <div class="form-group">
                        <label for="rentTypeId">租用类型</label>
                        <select name="rentTypeId" id="rentTypeId" class="form-control">
                            <option value="">----请选择租用类型----</option>
                            <#list rentTypeList as t>
                                <option value="${t.id}" <#if (deposit.rentTypeId!0)==t.id>selected="selected"</#if>>${t.name}</option>
                            </#list>
                        </select>
                    </div>
                    <div class="form-group">
                        <label for="name">Name</label>
                        <input type="text" value="${(deposit.name)!}" class="form-control" name="name" id="name">
                    </div>

                    <div class="form-group">
                        <label for="code">Code</label>
                        <input type="text" value="${(deposit.code)!}" class="form-control" name="code" id="code">
                    </div>

                    <div class="form-group">
                        <label for="value">金额</label>
                        <input type="text" value="${(deposit.value)!}" class="form-control" name="value" id="value">
                    </div>

                    <div class="form-group">
                        <label for="remark">Note</label>
                        <input type="text" value="${(deposit.remark)!}" class="form-control" name="remark" id="remark">
                    </div>

                    <div class="form-group">
                        <label for="valid">Valid</label>
                        <select  name="valid" id="valid" class="form-control">
                            <option value="true" <#if ((deposit.valid)!true)==true> selected="selected" </#if>>----Valid----</option>
                            <option value="false" <#if ((deposit.valid)!true)==false> selected="selected" </#if>>----Invalid----</option>
                        </select>
                    </div>
                    <div class="box-footer">
                        <button type="button" onclick="$('#depositForm').submit();" class="btn btn-primary">Save
                        </button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
<script type="text/javascript">
    $(function() {
        $("#depositForm").validate({
            submitHandler:function(form){
                submitDeposit();
            }
        });
    });
    function submitDeposit(){
        HF.ajaxFormSubmit('depositForm',function(result){
            alert("Save Success");
            document.location.reload();
        },function(e){ alert("Save Failure");});
    }
</script>
